# _*_ encoding:utf-8 _*_

from rest_framework import serializers

from goods.models import SPU, Brand


class BrandSimpleModelSerialzier(serializers.ModelSerializer):
    """品牌模型类序列化器"""

    class Meta:
        model = Brand
        fields = ['id', 'name']


class SPUGoodsSerialzier(serializers.ModelSerializer):
    """SPU模型类序列化器"""
    brand = serializers.StringRelatedField()
    brand_id = serializers.IntegerField()

    category1_id = serializers.IntegerField()
    category2_id = serializers.IntegerField()
    category3_id = serializers.IntegerField()

    class Meta:
        model = SPU
        exclude = ['category1', 'category2', 'category3', 'update_time', 'create_time']




